import { useContext } from "react";
import Render from ".";
import { QuickCodeContext } from "../../render/context";
import { DesignFrameworkContext } from "../../design/context";
import { findArrayBy } from "@/pages/quick-code/@quick-code/design/utils/array";
import { Button } from "antd";

const Design = (props) => {
  const { activeItem, schema, updateDesign } = useContext(DesignFrameworkContext)
  console.log({ props })
  return <div onClick={() => {

    let item = findArrayBy(schema.children, activeItem.id, 'id')

    if (item) {

      item.columns = [{
        title: '测试',
        dataIndex: ''
      }, {
        title: '操作',
        render() {
          return <div>
            <Button type="link">测试</Button>
          </div>
        }
      }
      ]

      updateDesign()
    }
  }}>设置</div>

}

export default {
  Render,
  Design
}